﻿//-----------------------------------------------------------------------
// <summary>
//  The file contains a class that used to treat style cop settings 
// </summary>
// <copyright file="ShellView.xaml.cs" company="DSSoftLogic">
//     Copyright@ DSSoftLogic 2011, Non-Commercial. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace Property
{
    using System;
    using System.ComponentModel.Composition;
    using System.Windows.Controls;
    using System.Windows.Navigation;
    using Telerik.Windows.Controls;

    /// <summary>
    /// <see cref="UserControl"/> class providing the main UI for the application.
    /// </summary>
    [Export]
    public partial class ShellView : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellView"/> class.
        /// </summary>
        public ShellView()
        {
            InitializeComponent();
        }

        /// <summary>
        /// After the Frame navigates, ensure the <see cref="HyperlinkButton"/> representing the current page is selected
        /// </summary>
        private void ContentFrame_Navigated(object sender, NavigationEventArgs e)
        {
            //foreach (UIElement child in LinksStackPanel.Children)
            //{
            //    HyperlinkButton hb = child as HyperlinkButton;
            //    if (hb != null && hb.NavigateUri != null)
            //    {
            //        if (hb.NavigateUri.ToString().Equals(e.Uri.ToString()))
            //        {
            //            VisualStateManager.GoToState(hb, "ActiveLink", true);
            //        }
            //        else
            //        {
            //            VisualStateManager.GoToState(hb, "InactiveLink", true);
            //        }
            //    }
            //}
        }

        /// <summary>
        /// If an error occurs during navigation, show an error window
        /// </summary>
        private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            e.Handled = true;
            ErrorWindow.CreateNew(e.Exception);
        }

        private void RadMenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            RadMenuItem item = e.Source as RadMenuItem;

            if (item != null)
            {
                switch (item.Header.ToString())
                {
                    case "NewProject":
                        ////this.ContentFrame.Navigate(new Uri("/About", UriKind.Relative));
                        break;
                }
            }


        }
    }
}
